home *** CD-ROM | disk | FTP | other *** search
/ Programming Languages Suite / ProgramD2.iso / Borland / Borland C++ V5.02 / GDIDIB.PAK / PRINT.C < prev    next >
C/C++ Source or Header  |  1997-05-06  |  4KB  |  148 lines

  1. // THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF
  2. // ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO
  3. // THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A
  4. // PARTICULAR PURPOSE.
  5. //
  6. // Copyright (C) 1993 - 1995  Microsoft Corporation.  All Rights Reserved.
  7. //
  8. //  MODULE: print.c
  9. //
  10. //  PURPOSE: Handle the application specific printing commands based on
  11. //    parameters gathered from the common printer dialog box.
  12. //
  13. //  FUNCTIONS:  
  14. //    CmdPrint      - Handles the File Print command (disabled).
  15. //    CmdPageSetup  - Handles the File PageSetup command (disabled).                
  16. //    CmdPrintSetup - Handles the File PrintSetup command (disabled).
  17. //
  18. //
  19. //  COMMENTS:
  20. //
  21. //  SPECIAL INSTRUCTIONS: N/A
  22. //
  23.  
  24.  
  25. #include <windows.h>            // required for all Windows applications 
  26. #include <windowsx.h> 
  27.            
  28. #include <string.h>
  29.            
  30. #include "globals.h"            // prototypes specific to this application
  31. #include "resource.h"
  32. #include "statbar.h"
  33.  
  34. // buffer for string resources
  35. char szBuff[50];              // watch out for recursive use of this buffer!
  36.    
  37.   
  38. //  FUNCTION: CmdPrint(HWND, WORD, WORD, HWND)
  39. //
  40. //  PURPOSE: Display statusbar updates by calling SendMessage(..SB_SETTEXT..).
  41. //
  42. //  PARAMETERS:
  43. //    hwnd     - The window.
  44. //    wCommand - WM_COMMAND 
  45. //    wNotify  - Notification number (unused)
  46. //    hwndCtrl - NULL (unused)
  47. //
  48. //  RETURN VALUE:
  49. //    Always returns 0 - command handled.
  50. //
  51. //  COMMENTS:
  52. //   
  53. //
  54.  
  55. #pragma argsused
  56. LRESULT CmdPrint(HWND hwnd, WORD wCommand, WORD wNotify, HWND hwndCtrl)
  57. {
  58.      int cbWritten;
  59.    
  60.     cbWritten = LoadString(hInst, wCommand, szBuff, sizeof(szBuff));
  61.     if(cbWritten == 0)
  62.         lstrcpy(szBuff, "Unknown Command");
  63.         
  64.     UpdateStatusBar(szBuff, 0, 0);
  65.  
  66.     // implementation code will go here
  67.  
  68.     // once command is executed, set the statusbar text to original
  69.     UpdateStatusBar(SZDESCRIPTION, 0, 0);  
  70.     
  71.     return 0;
  72. }
  73.    
  74. //  FUNCTION: CmdPageSetup(HWND, WORD, WORD, HWND)
  75. //
  76. //  PURPOSE: Display statusbar updates by calling SendMessage(..SB_SETTEXT..).
  77. //
  78. //  PARAMETERS:
  79. //    hwnd     - The window.
  80. //    wCommand - WM_COMMAND
  81. //    wNotify  - Notification number (unused)
  82. //    hwndCtrl - NULL (unused)
  83. //
  84. //  RETURN VALUE:
  85. //    Always returns 0 - command handled.
  86. //
  87. //  COMMENTS:
  88. //   
  89. //
  90.  
  91. #pragma argsused
  92. LRESULT CmdPageSetup(HWND hwnd, WORD wCommand, WORD wNotify, HWND hwndCtrl)
  93. {
  94.      int  cbWritten;
  95.  
  96.     cbWritten = LoadString(hInst, wCommand, szBuff, sizeof(szBuff));
  97.     if(cbWritten == 0)
  98.         lstrcpy(szBuff, "Unknown Command");
  99.         
  100.     UpdateStatusBar(szBuff, 0, 0);
  101.    
  102.     // implementation code will go here
  103.  
  104.     // once command is executed, set the statusbar text to original
  105.     UpdateStatusBar(SZDESCRIPTION, 0, 0);
  106.      return 0;
  107. }
  108.  
  109.    
  110. //  FUNCTION: CmdPrintSetup(HWND, WORD, WORD, HWND)
  111. //
  112. //  PURPOSE:  Display statusbar updates by calling SendMessage(..SB_SETTEXT..).
  113. //
  114. //  PARAMETERS:
  115. //    hwnd     - The window.
  116. //    wCommand - WM_COMMAND
  117. //    wNotify  - Notification number (unused)
  118. //    hwndCtrl - NULL (unused)
  119. //
  120. //  RETURN VALUE:
  121. //    Always returns 0 - command handled.
  122. //
  123. //  COMMENTS:
  124. //    Assumes there is a resource string describing this command with the
  125. //    same ID as the command ID.  Loads the string and calls UpdateStatusBar
  126. //    to put the string into main pane of the status bar.
  127.  
  128.  
  129. #pragma argsused
  130. LRESULT CmdPrintSetup(HWND hwnd, WORD wCommand, WORD wNotify, HWND hwndCtrl)
  131. {
  132.      int  cbWritten;
  133.  
  134.     cbWritten = LoadString(hInst, wCommand, szBuff, sizeof(szBuff));
  135.     if(cbWritten == 0)
  136.         lstrcpy(szBuff, "Unknown Command");
  137.         
  138.     UpdateStatusBar(szBuff, 0, 0);
  139.     
  140.     // implementation code will go here
  141.  
  142.     // once command is executed, set the statusbar text to original
  143.     UpdateStatusBar(SZDESCRIPTION, 0, 0);
  144.  
  145.     return 0;
  146. }
  147.  
  148.